angular.module('starter', ['ionic', 'starter.controllers', 'starter.services'])
	.run(function($ionicPlatform) {
		$ionicPlatform.ready(function() {
			if(window.cordova && window.cordova.plugins.Keyboard) {
				cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
				cordova.plugins.Keyboard.disableScroll(true);

			}
			if(window.StatusBar) {

				StatusBar.styleDefault();
			}
		});
	})

	.config(function($stateProvider, $urlRouterProvider) {
		$stateProvider
			.state('app', {
				url: '/app',
				abstract: true,
				templateUrl: 'templates/menu.html',
				controller: 'AppCtrl'
			})
			.state('app.login', {
				url: '/login',
				views: {
					'menuContent': {
						templateUrl: 'templates/login.html',
					}
				}
			})
			.state('app.search', {
				url: '/search',
				views: {
					'menuContent': {
						templateUrl: 'templates/search.html',
						controller: 'searchCtrl'
					}
				}
			})

			.state('app.browse', {
				url: '/browse',
				views: {
					'menuContent': {
						templateUrl: 'templates/browse.html',
						controller:'browserCtrl'
					}
				}
			})
			.state('app.playlists', {
				url: '/playlists',
				views: {
					'menuContent': {
						templateUrl: 'templates/playlists.html',
						controller: 'PlaylistsCtrl'
					}
				}
			})

			.state('app.single', {
				url: '/playlists/:playlistId',
				views: {
					'menuContent': {
						templateUrl: 'templates/playlist.html',
						controller: 'PlaylistCtrl'
					}
				}
			})
			.state('app.singledetail', {
				url: '/playlistdetail',
				views: {
					'menuContent': {
						templateUrl: 'templates/playdetail.html',
						controller: 'PlaylistDetailCtrl'
					}
				}
			});
		$urlRouterProvider.otherwise('/app/playlists');
	});
